SlideShare a Scribd company logo
1 of 47
Building YUI 3 Custom Modules Caridy Patino Frontend Engineer at Yahoo! YUI Contributor Bubbling Library Creator
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object]
What is a module in  YUI 3?
YUI 3 Modules
Using a module ,[object Object],[object Object],[object Object]
Using multiple modules ,[object Object],[object Object],[object Object],[object Object]
Sandboxing modules ,[object Object],[object Object],[object Object],[object Object],[object Object]
Sandboxing modules ,[object Object],[object Object],[object Object],[object Object]
Sandboxing modules
Different sets of modules YUI 3 Modules
Different sets of modules YUI 3 Modules Community modules gallery-*
Different sets of modules YUI 3 Modules Community modules gallery-* Project modules project-*
Community modules Time Picker Accordion / Node Accordion YQL
Project modules
How to use Custom Modules in YUI 3?
Custom Module Registration ,[object Object],[object Object],[object Object],[object Object],[object Object]
Registration by seed ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Registration by inclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Registration by configuration ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Organizing configuration ,[object Object],[object Object],[object Object]
Organizing configuration (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How to build a Custom Modules?
Defining a module ,[object Object],[object Object],[object Object],[object Object],[object Object]
Different types of  implementations Utilities Y .one Y .io Y .youtube.play
Different types of  implementations Utilities Y .Anim Y .App.Box Classes
Different types of  implementations Utilities Plugins Y .Plugin.NodeAccordion Classes
Different types of  implementations Utilities Plugins Mashups & Legacy Classes
Utilities ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classes
Classes (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classes (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
How to use and build plugins in YUI 3?
Plugins: YUI Node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Plugins (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Plugins (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How to work with mashups and legacy code in YUI 3?
Mashups ,[object Object],[object Object],[object Object],[object Object]
Mashups ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Mashups (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Legacy - YUI 2.x Tabview - Custom Survey System
Legacy (cont.) ,[object Object],[object Object],[object Object],[object Object]
Legacy (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Legacy (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Legacy (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Recommendations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conclusions ,[object Object],[object Object],[object Object],[object Object]
Thanks! Caridy Patino http://caridy.name/ http://github.com/caridy http://twitter.com/caridy

More Related Content

More from Caridy Patino

YUIConf2012: Mojito for YUI Developers
YUIConf2012: Mojito for YUI DevelopersYUIConf2012: Mojito for YUI Developers
YUIConf2012: Mojito for YUI DevelopersCaridy Patino
 
BayJax: Expanding Yahoo! Axis across 3 screens
BayJax: Expanding Yahoo! Axis across 3 screensBayJax: Expanding Yahoo! Axis across 3 screens
BayJax: Expanding Yahoo! Axis across 3 screensCaridy Patino
 
HTML5 summit - DevCon5 - Miami - Feb 2, 2012
HTML5 summit - DevCon5 - Miami - Feb 2, 2012HTML5 summit - DevCon5 - Miami - Feb 2, 2012
HTML5 summit - DevCon5 - Miami - Feb 2, 2012Caridy Patino
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSCaridy Patino
 
JS Loading strategies
JS Loading strategiesJS Loading strategies
JS Loading strategiesCaridy Patino
 
YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010Caridy Patino
 

More from Caridy Patino (6)

YUIConf2012: Mojito for YUI Developers
YUIConf2012: Mojito for YUI DevelopersYUIConf2012: Mojito for YUI Developers
YUIConf2012: Mojito for YUI Developers
 
BayJax: Expanding Yahoo! Axis across 3 screens
BayJax: Expanding Yahoo! Axis across 3 screensBayJax: Expanding Yahoo! Axis across 3 screens
BayJax: Expanding Yahoo! Axis across 3 screens
 
HTML5 summit - DevCon5 - Miami - Feb 2, 2012
HTML5 summit - DevCon5 - Miami - Feb 2, 2012HTML5 summit - DevCon5 - Miami - Feb 2, 2012
HTML5 summit - DevCon5 - Miami - Feb 2, 2012
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JS
 
JS Loading strategies
JS Loading strategiesJS Loading strategies
JS Loading strategies
 
YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Building YUI 3 Custom Modules

Editor's Notes

  1. This talk will cover how to use YUI 3.x infrastructure to create individual pieces of code that can be injected in any page to carry on a certain functionality. Also how these mashups can combine YUI widgets and utilities with 3rd party codes and how to reuse them between different YUI instances.
  2. I will talk about modules as the basic structures in YUI 3 Modules that are not part of YUI 3.0 How to Use and extend modules Organization and granularity: From global to granular approaches (Wordpress, Drupal, to Y! Front Page, Y! Mail, Gmail, Mint.com, etc) And finally, we will see how to bring legacy code into a YUI 3 implementation, including yui 2 stuff
  3. Let’s start from the very beginning: Every piece of code, in yui 3, is a module, just like in yui 2 All the code in yui 3 was designed with the sandboxing capabilities in mind A module represent an individual piece of software that can work alone, or in conjunction with other modules. - YUI 3.0 was shipped with a limited set of modules
  4. As you can see, modules can represent a widget: something that you will see in the page, like an overlay. Or just a low level utility to parse an string, like json utility. - Let’s see how we can use these built-in modules in a page
  5. First of all, to use a module, we need a YUI instance, we call it sandbox. “ use” is the basic method to inject modules into a sandbox. RED elements represent a reference to the sandbox object “ use” includes the requirements in the page (in this case, just “node”) and then it calls the callback function
  6. In this example we have 2 different modules playing together in the same sandbox
  7. The origin of the new syntax in yui 3.x, and how sandbox works
  8. similar feature, different syntax
  9. you can call “use” at anytime. In this case the second callback receive a reference to a sandbox. Y2 === Y.
  10. Now, what about those modules that are not part of YUI 3.0? Those modules that we will like to use in the daily basics Or those specific modules that we will like to have for one particular project
  11. Now that we have the brand new YUI 3 Gallery, we will have custom modules created by YUI Contributors
  12. And Finally, those modules that you will create for your app, for an specific project or just a piece of code that you will use in your daily basics.
  13. Few example of modules from the gallery: YQL wrapper Time Picker Collapsible and Expandable elements
  14. Few more examples of project and legacy modules: YUI 2.x tabview Survey widget
  15. The module registration process represents the action of adding module’s metadata to YUI 3 Loader. It needs to know: what is the name of the module? where is located? what are the dependencies (requirements)? and few more settings at the module level
  16. There are 3 different ways to register a module in yui 3. - By Seed - By Inclusion - By Configuration Let’s see each of them in details:
  17. - Just keep an eye on the performance with this approach
  18. - Recommended implementation
  19. - You can organize your repository of modules at the top. - YUI_config is not ready yet, it will be ready in 3.1 - In the meantime, you can use MY_YUI_config object to pass it thru all the YUI instances in your page
  20. Let’s focus on the implementation part and how we can extend the sandbox object
  21. Let’s go deeper in these different types of implementations
  22. Before going into the classes definitions, I will like to cover a set of utilities provided by YUI 3 to facilitate the creation of new classes.
  23. Continuing with the counter example, this module can be build using a class implementation, defining the prototype for that class as a new member for the current sandbox.
  24. Using the counter class
  25. Plugin Definition
  26. project-layout-lhs is a Custom Module to wrap a mashup implementation based on the previous example this new module can be now easily re-used thru a project/site/app It can also support specific configurations
  27. Legacy code is a big pain, specially for FE, and YUI 3 is not an exception. As you know YUI 2 and YUI 3 can play nicely in the same page, but who should control who? And what about the code that we wrote on top of YUI 2.x? Or any other JS code? In this slide you can see a muckup using YUI 2.x tabview, and also a custom survey system How can we bring this to YUI 3?
  28. Again, there are two ways to handle this: - Building a sandbox to wrap the legacy code, to delegate the loading process of all JS files to YUI 3 - The second option is to build a Custom Module to wrap the legacy code, and using this new module in your pages.
  29. - Building a sandbox to wrap the legacy code, to delegate the loading process of all JS files to YUI 3
  30. - The second option is to build a Custom Module to wrap the legacy code, and using this new module in your pages.